<template>
	<div class="biaoqi">
		<el-dialog title="标旗设置" center :visible.sync="biaoqi_log" :close-on-click-modal="false" width="600px">
			<div style="display: flex; align-items: center; margin-bottom: 20px; ">
				<div>抓单标旗：</div>

				<div>
					<el-select v-model="biaoqi_flag.fetch_order_flag" clearable placeholder="标旗">
                        <el-option label="请选择颜色" value="-1">
                            <span style="float: left">
                                <div class="color1"></div>
                            </span>
                            <span class="color1s">请选择颜色</span>
                        </el-option>
						<el-option label="灰" value="0">
							<span style="float: left">
								<div class="color1"></div>
							</span>
							<span class="color1s">灰</span>
						</el-option>
						<el-option label="红" value="1">
							<span style="float: left">
								<div class="color2"></div>
							</span>
							<span class="color2s">红</span>
						</el-option>
						<el-option label="黄" value="2">
							<span style="float: left">
								<div class="color3"></div>
							</span>
							<span class="color3s">黄</span>
						</el-option>
						<el-option label="绿" value="3">
							<span style="float: left">
								<div class="color4"></div>
							</span>
							<span class="color4s">绿</span>
						</el-option>
						<el-option label="蓝" value="4">
							<span style="float: left">
								<div class="color5"></div>
							</span>
							<span class="color5s">蓝</span>
						</el-option>
						<el-option label="紫" value="5">
							<span style="float: left">
								<div class="color6"></div>
							</span>
							<span class="color6s">紫</span>
						</el-option>
					</el-select>
				</div>
			</div>
			<div style="display: flex; align-items: center; margin-bottom: 20px; ">
				<div>生产失败：</div>
				<div>
					<el-select v-model="biaoqi_flag.produce_fail_flag" clearable placeholder="标旗">
                        <el-option label="请选择颜色" value="-1">
                            <span style="float: left">
                                <div class="color1"></div>
                            </span>
                            <span class="color1s">请选择颜色</span>
                        </el-option>
						<el-option label="灰" value="0">
							<span style="float: left">
								<div class="color1"></div>
							</span>
							<span class="color1s">灰</span>
						</el-option>
						<el-option label="红" value="1">
							<span style="float: left">
								<div class="color2"></div>
							</span>
							<span class="color2s">红</span>
						</el-option>
						<el-option label="黄" value="2">
							<span style="float: left">
								<div class="color3"></div>
							</span>
							<span class="color3s">黄</span>
						</el-option>
						<el-option label="绿" value="3">
							<span style="float: left">
								<div class="color4"></div>
							</span>
							<span class="color4s">绿</span>
						</el-option>
						<el-option label="蓝" value="4">
							<span style="float: left">
								<div class="color5"></div>
							</span>
							<span class="color5s">蓝</span>
						</el-option>
						<el-option label="紫" value="5">
							<span style="float: left">
								<div class="color6"></div>
							</span>
							<span class="color6s">紫</span>
						</el-option>
					</el-select>
				</div>
			</div>
			<div style="display: flex; align-items: center; margin-bottom: 20px; ">
				<div>发货失败：</div>
				<div>
					<el-select v-model="biaoqi_flag.delivery_fail_flag" clearable placeholder="标旗">
                        <el-option label="请选择颜色" value="-1">
                            <span style="float: left">
                                <div class="color1"></div>
                            </span>
                            <span class="color1s">请选择颜色</span>
                        </el-option>
						<el-option label="灰" value="0">
							<span style="float: left">
								<div class="color1"></div>
							</span>
							<span class="color1s">灰</span>
						</el-option>
						<el-option label="红" value="1">
							<span style="float: left">
								<div class="color2"></div>
							</span>
							<span class="color2s">红</span>
						</el-option>
						<el-option label="黄" value="2">
							<span style="float: left">
								<div class="color3"></div>
							</span>
							<span class="color3s">黄</span>
						</el-option>
						<el-option label="绿" value="3">
							<span style="float: left">
								<div class="color4"></div>
							</span>
							<span class="color4s">绿</span>
						</el-option>
						<el-option label="蓝" value="4">
							<span style="float: left">
								<div class="color5"></div>
							</span>
							<span class="color5s">蓝</span>
						</el-option>
						<el-option label="紫" value="5">
							<span style="float: left">
								<div class="color6"></div>
							</span>
							<span class="color6s">紫</span>
						</el-option>
					</el-select>
				</div>
			</div>

			<span slot="footer" class="dialog-footer">
				<el-button type="info" round @click="biaoqi_log = false">取 消</el-button>
				<el-button type="danger" round @click="gogogo">确 定</el-button>
			</span>
		</el-dialog>
	</div>
</template>

<script>
	import axios from "axios";
	export default{
		name: 'biaoqi',
		props:['source'],
		data(){
			return{
				biaoqi_log:false,
				biaoqi_flag:{
					fetch_order_flag:"",
					produce_fail_flag:"",
					delivery_fail_flag:""
				}
			}
		},

		created() {
			axios.get('/api/plan-market/get/shop/flag?source='+this.source)
				.then(response => {
					if (response.data.msg.code == 0) {
						// this.$message.success('设置成功');
            if(response.data.data.flag == null){
              response.data.data.flag = 0
            }
						this.biaoqi_flag = {
							fetch_order_flag:response.data.data.flag.toString(),
							produce_fail_flag:response.data.data.produce_fail_flag.toString(),
							delivery_fail_flag:response.data.data.delivery_fail_flag.toString()
						}
						console.log(this.biaoqi_flag)
						// this.biaoqi_log = false
					} else {
						this.$message.error(response.data.msg.info);
					}
				})
		},
		methods:{
			gogogo:function(){
				axios.post('/api/plan-market/set/shop/flag', {
						source: this.source,
						fetch_order_flag:this.biaoqi_flag.fetch_order_flag,
						produce_fail_flag:this.biaoqi_flag.produce_fail_flag,
						delivery_fail_flag:this.biaoqi_flag.delivery_fail_flag
					})
					.then(response => {
						if (response.data.msg.code == 0) {
							this.$message.success('设置成功');
							// this.biaoqi_flag = {
							// 	fetch_order_flag:"",
							// 	produce_fail_flag:"",
							// 	delivery_fail_flag:""
							// }
							this.biaoqi_log = false
						} else {
							this.$message.error(response.data.msg.info);
						}
					})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.biaoqi{

	}
</style>
